<!DOCTYPE html>
<!-- saved from url=(0065)http://www.17sucai.com/preview/1268063/2018-08-03/Mail/index.html -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>我的订单</title>
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<meta content="telephone=no" name="format-detection">
<link href="/carworld_weixin/css/order-style.css" rel="stylesheet" type="text/css">
<link href="/carworld_weixin/css/loader.min.css" rel="stylesheet">
<script type="text/javascript" src="/carworld_weixin/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/carworld_weixin/js/tab.js"></script>
<script src="/carworld_weixin/js/loading.js"></script>
<style type="text/css">
.tb960x90 {
	display: none !important;
	display: none
}
</style>
</head>
<body>
	<section class="aui-flexView">
		<header class="aui-navBar aui-navBar-fixed">
			<a href="javascript:history.back(-1)" class="aui-navBar-item">
				<i class="icon icon-return"></i>
			</a>
			<div class="aui-center">
				<span class="aui-center-title">我的订单</span>
			</div>

		</header>
		<section class="aui-scrollView">
			<div class="aui-tab" data-ydui-tab="">
				<ul class="tab-nav">
					<li class="tab-nav-item">
						<a href="javascript:;" onclick="allOrderList()">全部</a>
					</li>
					<li class="tab-nav-item tab-active">
						<a href="javascript:;" onclick="unpaidOrderList()">待付款</a>
					</li>
					<li class="tab-nav-item">
						<a href="javascript:;" onclick="paidOrderList()">已完成</a>
					</li>
					<li class="tab-nav-item">
						<a href="javascript:;" onclick="cancelledOrderList()">已取消</a>
					</li>
				</ul>
				<div class="divHeight"></div>
				<!--动态显示订单信息 start  -->
				<div class="tab-panel" id="myOrderList"></div>
				<!--动态显示订单信息 end  -->
			</div>
		</section>
	</section>
	<script>

	$(document).ready(function () { 
		unpaidOrderList();
    });
	
	
//查看全部订单列表
function allOrderList(){
    $('#myOrderList').empty();
	$.ajax({
		type : 'GET',
		url : '/carworld_weixin/order/myAllOrderList',
		dataType : 'json',
		contentType : 'application/json',
		success : function(data) {
			var count=data.shopOrder.length;
			if(0==count){
				$('#myOrderList').append('<div style="text-align:center;font-size:14px;color:#bbb;">您还没有订单哦~</div>');
				loading(false);
				return;
			}
			$.each(data.shopOrder, function(index, elem) {
				var head=
				'<div class="tab-item"><a href="javascript:void(0);" class="aui-well-item aui-well-item-clear">'+
				'<div class="aui-well-item-hd"></div>'+
				'<div class="aui-well-item-bd"><h3>'+elem.shop_order_createtime+'</h3></div>'+
				'<span class="aui-well-item-fr">已完成</span></a>';
				$('#myOrderList').append(head); 
				
				$.each(elem.shopRecord, function(i, value) {
					var body=
						'<div class="aui-mail-product" data-toggle="modal" data-target="#myModal" ><a href="javascript:;" class="aui-mail-product-item">'+
							'<div class="aui-mail-product-item-hd"><img src="'+value.spare_photo+'" alt=""></div>'+
							'<div class="aui-mail-product-item-bd"><p>'+value.spare_model+'</p></div>'+
							'<div class="aui-mail-product-right"><h4>￥'+value.shop_record_price+'</h4><span>x'+value.shop_record_number+'</span>'+
							'</div></a></div>'; 
				   $('#myOrderList').append(body); 
				})
				var tail=
				'<a href="javascript:;" class="aui-mail-payment">实付款: <i>￥'+elem.shop_order_totalprice+'</i></p></a><div class="aui-mail-button">'+
				'<a href="/carworld_weixin/">返回主页</a></div></div><div class="divHeight"></div>';
				$('#myOrderList').append(tail); 
			});
			loading(false);
		} 
	});
}


//查看待支付订单 
function unpaidOrderList(){
	$('#myOrderList').empty();
	$.ajax({
		type : 'GET',
		url : '/carworld_weixin/order/myOrderList',
		dataType : 'json',
		contentType : 'application/json',
		data : {'orderStatus' : '0' },
		success : function(data) {
			var count=data.shopOrder.length;
			if(0==count){
				$('#myOrderList').append('<div style="text-align:center;font-size:14px;color:#bbb;">您还没有待支付的订单哦~</div>');
				loading(false);
				return;
			}
			$.each(data.shopOrder, function(index, elem) {
				var head=
				'<div class="tab-item"><a href="javascript:void(0);" class="aui-well-item aui-well-item-clear">'+
				'<div class="aui-well-item-hd"></div>'+
				'<div class="aui-well-item-bd"><h3>'+elem.shop_order_createtime+'</h3></div>'+
				'<span class="aui-well-wait">等待付款</span>';
				$('#myOrderList').append(head); 
				$.each(elem.shopRecord, function(i, value) {
					var body=
						'<div class="aui-mail-product"><a href="javascript:;" class="aui-mail-product-item">'+
							'<div class="aui-mail-product-item-hd"><img src="'+value.spare_photo+'" alt=""></div>'+
							'<div class="aui-mail-product-item-bd"><p>'+value.spare_model+'</p></div>'+
							'<div class="aui-mail-product-right"><h4>￥'+value.shop_record_price+'</h4><span>x'+value.shop_record_number+'</span>'+
							'</div></a></div>'; 
				   $('#myOrderList').append(body); 
				})
				var tail=
				'<a href="javascript:;" class="aui-mail-payment"><p>实付款: <i>￥'+elem.shop_order_totalprice+'</i></p></a><div class="aui-mail-button">'+
				'<a href="/carworld_weixin/pay/pre?orderId='+elem.shop_order_id+'">微信支付</a></div>'+
				'<div class="divHeight"></div>';
				$('#myOrderList').append(tail); 
			});
			loading(false);
		}
	});
}




//查看已完成订单
function paidOrderList(){
	$('#myOrderList').empty();
	$.ajax({
		type : 'GET',
		url : '/carworld_weixin/order/myOrderList',
		dataType : 'json',
		contentType : 'application/json',
		data : {'orderStatus' : '1' },
		success : function(data) {
			var count=data.shopOrder.length;
			if(0==count){
				$('#myOrderList').append('<div style="text-align:center;font-size:14px;color:#bbb;">您还没有已完成的订单哦~</div>');
				loading(false);
				return;
			}
			$.each(data.shopOrder, function(index, elem) {
				var head=
				'<div class="tab-item"><a href="javascript:void(0);" class="aui-well-item aui-well-item-clear">'+
				'<div class="aui-well-item-hd"></div>'+
				'<div class="aui-well-item-bd"><h3>'+elem.shop_order_createtime+'</h3></div>'+
				'</a>';
				$('#myOrderList').append(head); 
				
				$.each(elem.shopRecord, function(i, value) {
					var body=
						'<div class="aui-mail-product"><a href="javascript:;" class="aui-mail-product-item">'+
							'<div class="aui-mail-product-item-hd"><img src="'+value.spare_photo+'" alt=""></div>'+
							'<div class="aui-mail-product-item-bd"><p>'+value.spare_model+'</p></div>'+
							'<div class="aui-mail-product-right"><h4>￥'+value.shop_record_price+'</h4><span>x'+value.shop_record_number+'</span>'+
							'</div></a></div>'; 
				   $('#myOrderList').append(body); 
				})
				var tail=
				'<a href="javascript:;" class="aui-mail-payment"><p>实付款: <i>￥'+elem.shop_order_totalprice+'</i></p></a><div class="aui-mail-button">'+
				'<a href="/carworld_weixin/">返回主页</a></div></div><div class="divHeight"></div>';
				$('#myOrderList').append(tail); 
			});
			loading(false);
		}
	});
}


//查看已取消订单
function cancelledOrderList(){
	$('#myOrderList').empty();
	$('#myOrderList').append('<div style="text-align:center;font-size:14px;color:#bbb;">您还没有已取消的订单哦~</div>');
}


//发送分红通知
function dividendNotify(){
	$.ajax({
		type : 'GET',
		url : '/carworld_weixin/order/dividendNotify',
		contentType : 'application/json',
		success : function(data) {
		}
	});
} 

</script>

</body>
</html>